<?php

/*
 * 后台系统设置文件 base.php
 * 
 */
class wyouyu extends yatou
{
    //核心设置
    function siteinfo()
    {
        if(!isset($this->post['submit']))
        {
            $this->tpl->display('siteinfo.tpl');
        }
        else//提交修改
        {
            foreach($this->post['webconfig'] as $key=>$value)
            {
                $this->db->query("replace into ".DBPREFIX."setting (`varible`,`value`) values ('$key','$value')");
            }
            $this->showmsg('修改成功!','','');
        }
    }
    //注册与访问
    function register()
    {
        if(!isset($this->post['submit']))
        {
            $baseConfig = GetBaseConfig();
            $this->tpl->display('register.tpl');
        }
        else
        {
            foreach($this->post['register'] as $key=>$value)
            {
                $this->db->query("replace into ".DBPREFIX."setting (`varible`,`value`) values ('$key','$value')");
            }
            $this->showmsg('修改成功!','','');
        }
    }
    //风格设置
    function style()
    {
        if(!isset($this->post['submit']))
        {
            $handle = opendir(Template);
            $fileArr = array();
            while(false!==($file = readdir($handle)))//在条件中定义的变量不能再在条件中使用
            {
                if($file!="."&&$file!='..')
                $fileArr[] =$file; 
            }
            $this->tpl->assign('fileArr',$fileArr);
            $this->tpl->display('style.tpl');
        }
        else
        {
            foreach($this->post['style'] as $key=>$value)
            {
                $this->db->query("replace into ".DBPREFIX."setting (`varible`,`value`) values ('$key','$value')");
            }
            $this->showmsg('修改成功!','','');
        }
    }
    //上传设置
    function upload()
    {
        if(!isset($this->post['submit']))
        {
            $this->tpl->display('upload.tpl');
        }
        else
        {
            foreach($this->post['upload'] as $key=>$value)
            {
                $this->db->query("replace into ".DBPREFIX."setting (`varible`,`value`) values ('$key','$value')");
            }
            $this->showmsg('修改成功!','','');
        }
    }
    //时间设置
    function timeSet()
    {
        if(!isset($this->post['submit']))
        {
            $this->tpl->display('timeset.tpl');
        }
        else
        {
            foreach($this->post['timeset'] as $key=>$value)
            {
                $this->db->query("replace into ".DBPREFIX."setting (`varible`,`value`) values ('$key','$value')");
            }
            $this->showmsg('修改成功!','','');
        }
    }
    //SEO设置
    function seo()
    {
        if(!isset($this->post['submit']))
        {
            $this->tpl->display('seo.tpl');
        }
        else
        {
            foreach($this->post['seo'] as $key=>$value)
            {
                $this->db->query("replace into ".DBPREFIX."setting (`varible`,`value`) values ('$key','$value')");
            }
            $this->showmsg('修改成功!','','');
        }
    }
    //验证码
    function identifyCode()
    {
        if(!isset($this->post['submit']))
        {
            $this->tpl->display('validatecode.tpl');
        }
        else
        {
            foreach($this->post['validate'] as $key=>$value)
            {
                $this->db->query("replace into ".DBPREFIX."setting (`varible`,`value`) values ('$key','$value')");
            }
            $this->showmsg('修改成功!','','');
        }
    }
    //
}
?>
